#include<bits/stdc++.h>
using namespace std;
int c,t,n,m,u,v;
int main(){
freopen("oi.in","r",stdin);
freopen("oi.out","w",stdout);
   ios::sync_with_stdio(false);
   cin.tie(0),cout.tie(0);
   cin>>c>>t;
   while(t--){
   cin>>n>>m;
   for(int i=1;i<=m;i++)cin>>u>>v;
   cout<<-m-1<<" "<<(n*m)%998244353<<"\n";
   }
}
